import service from "@/api/index.js";

const orderApi = {
    //分页搜索
    selectByPage(order, pageNum, pageSize) {
        order.pageNum = pageNum
        order.pageSize = pageSize
        return service.get("/order", {
            params: order
        });
    },
    //根据ID查询
    selectById(id) {
        return service.get(`/order/${id}`);
    },
    //根据ID查询
    selectId(id) {
    return service.get(`/order/id/${id}`);
},
    //修改订单信息
    update(order) {
        return service.put("/order", order);
    },
    //添加
    insert(orderVo) {
        return service.post("/order", orderVo);
    },
    //支付
    pay(orderVo){
        return service.post("/order/pay", orderVo);
    },
    selectByUser(pageNum, pageSize) {
        return service.get("/order/user", {
            params: {
                pageNum,
                pageSize
            }
        });
    },
    received(id){
        return service.put(`/order/${id}`);
    }
};

export default orderApi;